import Vue from 'vue'
import Router from 'vue-router'
/* Layout */
import Layout from '../views/layout/Layout'

Vue.use(Router)

/**
 * hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
 *                                if not set alwaysShow, only more than one route under the children
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
  }
 **/
export const constantRouterMap = [
  {path: '/acceptStore', component: () => import('@/views/login/acceptStore'), hidden: true},
  {path: '/login', component: () => import('@/views/login/index'), hidden: true},
  {path: '/404', component: () => import('@/views/404'), hidden: true},
  {
    path: '/store',
    component: () => import('@/views/home/store'),
    hidden: true
  },
  {
    path: '/',
    component: Layout,
    redirect: '/home',
    children: [{
      path: 'home',
      name: 'home',
      component: () => import('@/views/home/index'),
      meta: {title: '首页', icon: 'home'}
    }]
  },

  {
    path: '/sys',
    component: Layout,
    redirect: '/sys/admin',
    name: 'sys',
    meta: {title: '系统管理', icon: 'home'},
    children: [


      {
        path: 'admin',
        name: 'admin',
        component: () => import('@/views/sys/admin/index'),
        meta: {title: '用户列表', icon: 'product-list'}
      },
      {
        path: 'gen',
        name: 'gen',
        component: () => import('@/views/sys/gen/index'),
        meta: {title: '代码生成', icon: 'product-list'}
      }, {
        path: 'permissionCategory',
        name: 'permissionCategory',
        component: () => import('@/views/sys/permissionCategory/index'),
        meta: {title: '菜单类别列表}'}
      },
      {
        path: 'addPermissionCategory',
        name: 'addPermissionCategory',
        component: () => import('@/views/sys/permissionCategory/add'),
        meta: {title: '添加菜单类别', icon: 'permissionCategory-add'},
        hidden: true
      },
      {
        path: 'updatePermissionCategory',
        name: 'updatePermissionCategory',
        component: () => import('@/views/sys/permissionCategory/update'),
        meta: {title: '修改菜单类别', icon: 'permissionCategory-update'},
        hidden: true
      },
      {
        path: 'addAdmin',
        name: 'addAdmin',
        component: () => import('@/views/sys/admin/add'),
        meta: {title: '添加用户'},
        hidden: true
      },
      {
        path: 'updateAdmin',
        name: 'updateAdmin',
        component: () => import('@/views/sys/admin/update'),
        meta: {title: '编辑用户'},
        hidden: true
      },
      {
        path: 'role',
        name: 'role',
        component: () => import('@/views/sys/role/index'),
        meta: {title: '角色列表', icon: 'ums-role'}
      },
      {
        path: 'allocMenu',
        name: 'allocMenu',
        component: () => import('@/views/sys/role/allocMenu'),
        meta: {title: '分配菜单'},
        hidden: true
      },
      {
        path: 'permission',
        name: 'permission',
        component: () => import('@/views/sys/permission/index'),
        meta: {title: '权限列表', icon: 'product-list'}
      },
      {
        path: 'addPermission',
        name: 'addPermission',
        component: () => import('@/views/sys/permission/add'),
        meta: {title: '添加权限'},
        hidden: true
      },
      {
        path: 'updatePermission',
        name: 'updatePermission',
        component: () => import('@/views/sys/permission/update'),
        meta: {title: '编辑权限'},
        hidden: true
      },
      {
        path: 'area',
        name: 'area',
        component: () => import('@/views/sys/area/index'),
        meta: {title: '权限列表', icon: 'product-list'}
      },
      {
        path: 'addArea',
        name: 'addArea',
        component: () => import('@/views/sys/area/add'),
        meta: {title: '添加权限'},
        hidden: true
      },
      {
        path: 'updateArea',
        name: 'updateArea',
        component: () => import('@/views/sys/area/update'),
        meta: {title: '编辑权限'},
        hidden: true
      },
      {
        path: 'dict',
        name: 'dict',
        component: () => import('@/views/sys/dict/index'),
        meta:
            {
              title: '系统配置信息表列表}'
            }
      },
      {
        path: 'addDict',
        name: 'addDict',
        component: () => import('@/views/sys/dict/add'),
        meta: {
          title: '添加系统配置信息表',
          icon: 'dict-add'
        }
      },
      {
        path: 'updateDict',
        name: 'updateDict',
        component: () =>
            import('@/views/sys/dict/update'),
        meta:
            {
              title: '修改系统配置信息表',
              icon: 'dict-update'
            },
        hidden: true
      }, {
        path: 'job',
        name: 'job',
        component: () => import('@/views/sys/job/index'),
        meta:
            {
              title: '定时任务息表列表'
            }
      }, {
        path: 'joblog',
        name: 'joblog',
        component: () => import('@/views/sys/job/joblog'),
        meta:
            {
              title: '定时任务息表列表'
            }
      },
      {
        path: 'addJob',
        name: 'addJob',
        component: () => import('@/views/sys/job/add'),
        meta: {
          title: '添加定时任务',
          icon: 'dict-add'
        }
      },
      {
        path: 'updateJob',
        name: 'updateJob',
        component: () =>
            import('@/views/sys/job/update'),
        meta:
            {
              title: '修改定时任务',
              icon: 'dict-update'
            },
        hidden: true
      },


    ]
  },

  {path: '*', redirect: '/404', hidden: true}
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({y: 0}),
  routes: constantRouterMap
})

